package org.ef.anticheck;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBMgmt extends SQLiteOpenHelper {

	private static final int VERSION = 1;

	private static final String DBNAME = "siberian";

	public DBMgmt(final Context context) {
		super(context, DBNAME, null, VERSION);
	}

	@Override
	public void onCreate(final SQLiteDatabase db) {
		db.execSQL("CREATE TABLE siberian_blacklist (id int(11) NOT NULL, phone_number varchar(20) NOT NULL, region varchar(30) NOT NULL, service_providers varchar(30) NOT NULL, message varchar(30) NOT NULL, date_added datetime NOT NULL, PRIMARY KEY (id))");
		db.execSQL("INSERT INTO siberian_blacklist (id, phone_number, region, service_providers, message, date_added) VALUES (1, '15810372821', '北京', '移动', '这是骗子', '2012-02-29 14:28:25')");
	}

	@Override
	public void onUpgrade(final SQLiteDatabase db, final int oldVersion,
			final int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS siberian_blacklist");
		this.onCreate(db);
	}
}
